import 'package:lh_shop_flutter/util/util.dart';
import 'api.dart';
import 'dio_manager/dio_util.dart';

///
///Author: YYF
///Date: 2020-10-21 09:20:15
///Description:
///

class AppServer {
  /// 注册
  /// parentUserCode 父级用户邀请码
  static register(
      {String userName = '',
      String userPassword = '',
      String checkCode = '',
      String parentUserCode = '',
      Function(String code) success,
      Function(String msg) failure}) {
    DioManager().request(
      AppMethod.POST,
      AppApi.register,
      params: {
        "userName": userName,
        'userPassword': Util.generateMd5(userPassword),
        'checkCode': checkCode,
        'parentUserCode': parentUserCode
      },
      success: (response) {
        print(response.data);

        success(response.msg);
      },
      error: (e) {
        if (failure != null) {
          print(e.msg);
        }
      },
    );
  }
}
